package com.baiduspring.vo;

import com.baiduspring.dao.entity.UserDetails;
import com.baiduspring.utils.PreconditionsUtils;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@Data
@Accessors(chain = true)
@Slf4j
public class UserDetailsVO implements BaseVO<UserDetailsVO, UserDetails> {
    private Long id;

    private Long account;

    private String presentCity;

    private String postalAddress;

    private String school;

    private String major;

    private String company;

    private String personalProfile;

    private String personalWebsite;

    private String goodAtTechnology;

    private String resumeDescription;

    @Override
    public UserDetailsVO validate() {
        PreconditionsUtils.checkArgument(Objects.nonNull(account), "账号不能为空");
        if (StringUtils.isNotEmpty(personalProfile)) {
            PreconditionsUtils.checkArgument(personalProfile.length() <= 100, "简介内容过长，100字以内");
        }
        return this;
    }

}
